<?php $view->extend('forum/forum_template', 'content', array('title' => $forum->getTitle())); ?>
<?php if($user && $forum->canAddThread($user->getGmLevel())):?>
<div class="col c12 buttonpanel">
<a href="<?php echo $view->url->linkTo('Forum','newThread', array('title'=>$forum->getUrl()))?>" class="uibutton"><?php echo $view->lang->get('forum')->get('new_thread')?></a>
</div>
<?php endif; ?>



<?php if (count($threads) > 0): ?>
<div class="threads">

<?php $view->import('forum/pages', array('method' => 'showForum', 'args' => array('title'=>$forum->getUrl() ),'pages' => $pages, 'curPage' => $curPage  )); ?>



<div class="col c12">
<div class="row">
<div class="col c6">
<h2><?php echo $view->lang->get('forum')->get('title_thread_starter')?></h2>
</div>
<div class="col c2">
<h2><?php echo $view->lang->get('forum')->get('replies')?></h2>
</div>
<div class="col c4">
<h2><?php echo $view->lang->get('forum')->get('last_post_by')?></h2>
</div>
</div>
</div>



<?php foreach($threads as $thread):?>
<div class="col c12 thread">
	<div class="row">
		<div class="col c6 title <?php if ($user && $thread->hasNewChanges($user->getID()))echo "newchanges"?>">
			<?php if ($thread->isSticky()):?>
			<span class="sticky"><?php echo $view->lang->get('forum')->get('sticky')?></span>
			<?php endif;?>
			<h4><a href="<?php echo $view->url->linkTo('Forum','thread', array('title'=>$forum->getUrl(), 'id' => $thread->getID(),'page' => $thread->getLastPageNum() ))?>"><?php echo $thread->getTitle()?></a></h4>
			<?php if ($thread->isLocked()):?>
			<span class="locked"><?php echo $view->lang->get('forum')->get('locked')?></span>
			<?php endif;?>
			
			<p><?php $fp = $thread->getFirstPost(); $ac = $fp->getAccount(); echo sprintf($view->lang->get('forum')->get('started_by'), $ac->getUsername(),  $fp->getPostedSince() )?></p>
		</div>
		<div class="col c2">
			<p><?php echo $view->lang->get('forum')->get('replies')?>: <?php echo $thread->getPostCount() - 1;?></p>
		</div>
		<div class="col c4">
			<?php $lp = $thread->getLastPost(); ?>
			<?php if ($lp):?>
				<h4><?php echo $lp->getUsername()?></h4>
				<?php echo $lp->getPostedSince()?>
			<?php else:?>
				<p>No threads yet.</p>
			<?php endif;?>
		</div>
	</div>
</div>
<?php endforeach;?>


<?php $view->import('forum/pages', array('method' => 'showForum', 'args' => array('title'=>$forum->getUrl() ),'pages' => $pages, 'curPage' => $curPage  )); ?>

<?php else: ?>

<div class="col c12">
<div class="message info"><p><?php echo $view->lang->get('forum')->get('no_threads_in_forum')?></p></div>
</div>
<?php endif;?>



</div>